package collection;

import java.util.Arrays;
import java.util.List;

public class ArrayToListDemo {
    public static void main(String[] args) {
        String[] array = {"one", "two", "four","five"};
        System.out.println("array:"+ Arrays.toString(array));

        List<String> list=Arrays.asList(array);
        System.out.println("list:"+list);

        list.set(0,"zero");
        System.out.println("list:"+list);
        System.out.println("array:"+Arrays.toString(array));
        /**
         * support:支持
         * Unsupported:不支持
         * Operation:操作
         * java.lang.UnsupportedOperationException
         * 由于数组是定长的,因此对于集合可能改变元素个数的操作是不支持的,灰抛出上述错误
         */
        list.add("six");
      //  List<String> list2=ArraysList();
    }
}
